import {
    Controller,
    Get,
    Post,
    Body,
    Patch,
    Param,
    Delete,
    UseInterceptors,
    UploadedFile,
} from '@nestjs/common';
import { UploadService } from './upload.service';
import { FileInterceptor } from '@nestjs/platform-express';

@Controller('upload')
export class UploadController {
    constructor(private readonly uploadService: UploadService) {}

    @Post('upload')
    @UseInterceptors(FileInterceptor('file')) // 'file'为前端表单字段名
    uploadFile(@UploadedFile() file: Express.Multer.File) {
        return { path: file.path };
    }
}
